<%@ page language="java" pageEncoding="UTF-8"%>
<script type="text/javascript">
	$(function() {
		$('#user-register-form').form({
			url : '${pageContext.request.contextPath }/userAction!doNotNeedSession_register.action',
			onSubmit : function() {
				$.messager.progress({
	        		text : "提交数据，请等待..."
	        	});
			},
			success : function(data) {
				var d = $.parseJSON(data);
				if (d.success) {
					$('#user-register').dialog('close');
				} else {
					$('#user-register').find('input[name=name]').focus();
				}
				$.messager.progress('close');	//关闭进度条
				$.messager.show({
					msg : d.msg,
					title : '提示'
				});
			}
		});

		$('#user-register').dialog({
			iconCls : 'icon-save',
			title : '注册',
			resizable : true,
			closed : true,
			modal : true,
			buttons : [ {
				text : '注册',
				handler : function() {
					$('#user-register-form').submit();
				}
			}, {
				text : '取消',
				handler : function() {
					$('#user-register').dialog('close');
				}
			} ],
			onOpen : function() {
				window.setTimeout(function() {
					$("#user-reg-name").focus();
				}, 0);
			}
		});

		$('#user-register-form input').on('keyup', function(event) {
			if (event.keyCode == '13') {
				$("#user-register-form").submit();
			}
		});
	});
</script>

<div id="user-register" style="width:270px;height:200px;">
	<form id="user-register-form" method="post">
		<table class="tableForm">
			<tr>
				<th>用户名：</th>
				<td><input type="text" id="user-reg-name" name="name" class="easyui-validatebox" style="width: 200px" data-options="required:true" /></td>
			</tr>
			<tr>
				<th>密码：</th>
				<td><input type="password" id="user-reg-pwd" name="pwd" class="easyui-validatebox" style="width: 200px" data-options="required:true" /></td>
			</tr>
			<tr>
				<th>重复密码：</th>
				<td><input type="password" id="user-reg-repwd" name="repwd" class="easyui-validatebox" style="width: 200px" data-options="required:true,validType:'eqpwd[\'#user-reg-pwd\']'" /></td>
			</tr>
		</table>
	</form>
</div>